import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class ThreadFenster implements ActionListener
{
	public static void main(String[] args)
	{
		new ThreadFenster();
	}

	JButton button;
	JTextField textField;

	public ThreadFenster()
	{
		JFrame frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(400, 300);

		JPanel contentPanel = new JPanel();

		frame.setContentPane(contentPanel);

		textField = new JTextField();
		textField.setBackground(Color.BLUE);
		textField.setText("Mein TextField");

		button = new JButton("mein button");
		button.addActionListener(this);

		contentPanel.add(textField);
		contentPanel.add(button);

		frame.setVisible(true);
	}

	@Override
	public void actionPerformed(ActionEvent e)
	{
		System.out.println("Der Button wurde geklickt");

		float r = (float) Math.random();
		float g = (float) Math.random();
		float b = (float) Math.random();

		Color farbe = new Color(r, g, b);

		textField.setBackground(farbe);
		
		
		FibonacciRunnable fibRun = new FibonacciRunnable();
		
		
		Thread fibonacciThread = new Thread(fibRun);
		fibonacciThread.start();
		
		System.out.println("Button klick fertig");
	}
}
